<extend name="Base/common"/>

<block name="style">
    <link href="__CSS__/event.css" rel="stylesheet" type="text/css"/>
    <link type="text/css" rel="stylesheet" href="__STATIC__/oneplus/js/ext/magnific/magnific-popup.css"/>
</block>

<block name="body">



    <div class="row">
        <div class="col-md-12">

            <nav class="navbar navbar-default app_block event_navbar forum_module container_nav" role="navigation">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1" style="margin-top: 0px;">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class=" collapse navbar-collapse " id="bs-example-navbar-collapse-1"
                     style="  border-color: #fff;background: #FFFFFF;overflow-y: inherit;z-index: 99;">
                    <!--二级导航-->
                    <ul class="container_nav_tab" style="margin-top: 5px;">
                        <div class="col-md-4">
                            <li class="container_nav_tab_li active col-xs-4 col-md-4">
                                <a href="{:U('index')}">活动首页</a>
                            </li>
                            <li class="container_nav_tab_li col-xs-4 col-md-4">
                                <a href="{:U('myevent')}">我的活动</a>
                            </li>
                        </div>
                        <li class="pull-right">

                            <if condition="is_login() eq 0">
                                <button class="btn btn-primary event_btn" onclick="op_error('请登陆后再发布。','温馨提示')"><i
                                        class="glyphicon glyphicon-send"></i>&nbsp;发起活动
                                </button>
                                <else/>
                                <a class="btn btn-primary event_btn" href="{:U('Event/Index/add')}"><i
                                        class="glyphicon glyphicon-send"></i>&nbsp;发起活动
                                </a>

                            </if>

                        </li>
                    </ul>
                </div>
                <!-- /.navbar-collapse -->
            </nav>
        </div>
    </div>

    <div class="btn-group btn-group-sm">
        <a class="btn btn-default  <if condition="$tip eq all">active</if>" href="{:U('member',array('id'=>$content['id']))}">全部成员 <span class="badge">{$all_count}</span></a>
        <a class="btn btn-default  <if condition="$tip eq sign">active</if>"  href="{:U('member',array('id'=>$content['id'],'tip'=>'sign'))}">未审核 <span id="sign_count" class="badge">{$sign_count}</span></a>
        <a class="btn btn-default  <if condition="$tip eq attend">active</if>"  href="{:U('member',array('id'=>$content['id'],'tip'=>'attend'))}">已审核 <span id="attend_count" class="badge">{$attend_count}</span></a>
        <a  class="btn btn-default" href="{:U('detail',array('id'=>$content['id']))}">返回活动详情页</a>
    </div>




<div class="event_member_list" style="margin-top: 15px;">
    <volist name="content['member']" id="vo">

        <div class="col-md-2" style="height: 180px;">
            <div style="width: 128px;">
                <img ucard="{$vo.id}" src="{$vo.avatar128}" class="avatar-img" style="width: 128px;float: left"/>

                <div style="text-align: center;">
                    <div><a href="{$vo.space_url}"> {$vo.nickname} </a></div>
                    <php>if($content['uid'] == is_login() || is_administrator(is_login()) ){</php>

                    <a class="event_see_info" title="查看姓名联系方式"><span class="glyphicon glyphicon-hand-up"></span></a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <span>
                    <if condition="$vo['status'] eq 0">
                        <a data-uid="{$vo.id}" onclick="shenhe($(this))" title="通过审核"><span class="glyphicon glyphicon-ok"></span></a>
                        <else/>
                         <a data-uid="{$vo.id}"  onclick="qushenhe($(this))"  title="取消审核"><span class="glyphicon glyphicon-remove"></span></a>
                    </if>

                </span>

                    <div class="event_member_info"
                         style="position: absolute;z-index: 999;border: 1px solid #ccc ;background: #FFFFFF;text-align: left;width: 99%;padding: 5px 0 5px 10px;display: none">
                        <a class="event_member_info_close" style="float: right;margin-top: -5px;margin-right: 5px">X</a>
                        <div> {$vo.name}</div>
                        <div> {$vo.phone}</div>
                    </div>


                    <php>}</php>

                </div>
            </div>

        </div>


    </volist>

</div>

</block>

<block name="script">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript" src="__STATIC__/oneplus/js/ext/magnific/jquery.magnific-popup.min.js"></script>
    <script>
        $(function () {
            $('#top_nav >li >a ').mouseenter(function () {
                $('.children_nav').hide();
                $('#children_' + $(this).attr('data')).show();
            });
            bindSupport();

            $('.event_see_info').click(function () {
                $('.event_member_info').hide();
                $(this).parent().find('.event_member_info').show();
            })
            $('.event_member_info_close').click(function () {
                $('.event_member_info').hide();
            })


        })

        function shenhe(obj) {
            var uid = obj.attr('data-uid');
            var event_id = "{$content['id']}";
            var tip = 1;
            $.post("{:U('Event/Index/shenhe')}", {uid: uid, event_id: event_id, tip: tip}, function (res) {
                if (res.status) {
                    op_success(res.info);

                    var html = '<a data-uid="' + uid + '" onclick="qushenhe($(this))" title="取消审核"><span class="glyphicon glyphicon-remove"></span></a>';
                    obj.parent().html(html);
                    $('#attend_count').html(parseInt($('#attend_count').text()) + 1);
                    $('#sign_count').html(parseInt($('#sign_count').text()) - 1);
                }
                else {
                    op_error(res.info);
                }
            }, 'json');
        }

        function qushenhe(obj) {
            var uid = obj.attr('data-uid');
            var event_id = "{$content['id']}";
            var tip = 0;
            $.post("{:U('Event/Index/shenhe')}", {uid: uid, event_id: event_id, tip: tip}, function (res) {
                if (res.status) {
                    op_success(res.info);
                    var html = '<a data-uid="' + uid + '" onclick="shenhe($(this))" title="通过审核"><span class="glyphicon glyphicon-ok"></span></a>';
                    obj.parent().html(html);
                    $('#attend_count').html(parseInt($('#attend_count').text()) - 1);
                    $('#sign_count').html(parseInt($('#sign_count').text()) + 1);
                }
                else {
                    op_error(res.info);
                }
            }, 'json');
        }
    </script>

</block>
